<?php
    include_once ("datosReporte.php");
    include_once ("../ajax/generales.php");
    echo join($datos, ',');
?>
<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Highcharts Example</title>

<!--		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>-->
<!--                <script type="text/javascript" src="../extensions/jquery-ui-1.10.4/js/jquery-ui-1.10.4.custom.min.js"></script>-->
                <script type="text/javascript" src="../extensions/jquery.min.js"></script>
		<style type="text/css">
/*${demo.css}*/
		</style>
		<script type="text/javascript">
$(function () {
    $('#container').highcharts({
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: 1,//null,
            plotShadow: false
        },
        title: {
            text: 'Grafico de Atencion por usuario'
        },
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                    style: {
                        color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                    }
                }
            }
        },
        series: [{
            type: 'pie',
            name: 'Browser share',
            data: [ <?php echo join($datos, ','); ?> ]
//            data: [
//                ['mzamudio',   70.83],
//                ['mcarrion',       10.42],
//                ['dleon',    1.39],
//                ['otros',   1.39]
//            ]
        }]
    });
});


		</script>
	</head>
	<body>
<script src="../extensions/Highcharts-4.0.4/js/highcharts.js"></script>
<script src="../extensions/Highcharts-4.0.4/js/modules/exporting.js"></script>
<?Php 
    $html = "";
    if(sizeof($datos)==0){
        $html.= "<tr><td colspan='3' align='center'>";
        $html.= "No se encontraron registros";
        $html.= "</td></tr>";
    }else{
        
        foreach ($usuarios as $res){
            $html.="<tr style='font-family:verdana;font-size:12px;height:40px;'>";
            $html.="<td align='center'>".$res->usuario."</td>";
            $html.="<td align='center'>".$res->tickets."</td>";
            $html.="<td align='center'>".number_format($res->porcentaje,2)."%</td>";
            $html.="</tr>";
        }
    }
?>
<center>

                <table style='font-family:verdana;width:90%;'>
                    <tr><td align='right' colspan='2'><img src='../images/logo/indecopi2.png' width='250'/></td></tr>
                    <tr style='font-family:verdana;font-size:15px;'><td colspan='2' align='center'><h1>Reporte de Tickets</h1></td></tr>
                    <tr><td width='10%' colspan='2'><b>Desde :</b> &nbsp;&nbsp;<?php echo $desde; ?></td></tr>
                    <tr><td width='10%' colspan='2'><b>Hasta :</b> &nbsp;&nbsp;<?php echo $hasta; ?></td></tr>
                    <tr><td colspan='2' ><hr></td></tr>
                    <tr>
                        <td align='center' width='50%'>
                            <table style='font-family:verdana;width:90%;border-collapse: collapse;' border="1" >
                                <tr style='font-family:verdana;background:#ccc;font-size:12px;height:40px;'>
                                    <th>Usuario</th>
                                    <th>Num. de Tickets Atendidos</th>
                                    <th>Porcentaje de Tickets Atendidos</th>
                                </tr>
                                <?php echo $html; ?>
                            </table>
                        </td>
                        <td width='50%'>
                            <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
                          
                        </td>
                    </tr>
                </table>  
              
</center>
        <?Php 
            $desde_fecha = convertir_fecha($_GET["desde"]);
            $hasta_fecha = convertir_fecha($_GET["hasta"]);
            
            echo $desde_fecha."<br>";
            echo $hasta_fecha;
        ?>
	</body>
</html>